<%@ page language="java" import="java.util.*,com.hs.wdss.model.*,com.hs.core.cache.*" pageEncoding="utf-8"%>
<%
	WdssDisinfo obj = (WdssDisinfo)request.getAttribute("obj");
	String causecode26 = "";
	String causecode27 = "";
	String causecode28 = "";
	String memo = "";
	if(obj != null && !obj.getDiscauseset().isEmpty()){
		Set causeset = obj.getDiscauseset();
	    Iterator iter = causeset.iterator();
	    while(iter.hasNext()){
	        WdssDiscauseinfo cause = (WdssDiscauseinfo)iter.next();
	        String datatype = cause.getDatatype()+"";
	        memo = cause.getMemo();
	        if("26".equals(datatype)){
	          	causecode26 = causecode26 + cause.getCausecode() + ",";
	        }else if("27".equals(datatype)){
	        	causecode27 = causecode27 + cause.getCausecode() + ",";
	        }else if("28".equals(datatype)){
	        	causecode28 = causecode28 + cause.getCausecode() + ",";
	        }
	    }        	
	}
 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="../../include.jsp"%>  
<script src="<%=basePath %>app/javascripts/transform.js"></script>
<script src='<%=basePath%>dwr/interface/dataProhelper.js'></script>  
<script language="javascript" type="text/javascript">
function savedata()
{
	var wdssid = window.parent.datapromenu.document.all.wdssid.value;
	if(wdssid == ""){
		alert("请先保存医案信息！");	
		return;
	}else {
		var memo = document.getElementById("memo").value; 
		var causecode26obj = document.getElementsByName("causecode26"); 
	    var causecode26str = "";
	    for(var i=0;i<causecode26obj.length;i++){         
	      	if(causecode26obj[i].checked){   
	          	  causecode26str += causecode26obj[i].value+",";         
	        }         
	    }
	    
	    var causecode27obj = document.getElementsByName("causecode27"); 
	    var causecode27str = "";
	    for(var i=0;i<causecode27obj.length;i++){         
	      	if(causecode27obj[i].checked){   
	          	  causecode27str += causecode27obj[i].value+",";         
	        }         
	    }
	    
	    var causecode28obj = document.getElementsByName("causecode28"); 
	    var causecode28str = "";
	    for(var i=0;i<causecode28obj.length;i++){         
	      	if(causecode28obj[i].checked){   
	          	  causecode28str += causecode28obj[i].value+",";         
	        }         
	    }
	    
		if(isNull(causecode26str) && isNull(causecode27str) && isNull(causecode28str)){
			alert("请选择病因！");
			return; 
   		}
	   	dataProhelper.addCause(wdssid,memo,causecode26str,causecode27str,causecode28str,callback4addDis);
	}
	
}
function callback4addDis(message){ 
	if(message != null){
		 alert('病因信息保存成功！'); 
		 //刷新左边菜单
	 	var wdssid = window.parent.datapromenu.document.all.wdssid.value;
	 	window.parent.datapromenu.frameElement.src = "<%=basePath%>produce/datapromenu.do?wdssid="+wdssid;
	}
}

function backlist()
{
	window.parent.window.location.href = "<%=basePath%>produce/dataprolist.do"
}
</script>
</head>
<body>
<div class="current">当前位置：数据加工 &gt; 病因信息</div>
		
        <table border="0" cellspacing="0" cellpadding="0" class="news"> 
        <caption>
          病因信息
          </caption>
          <tr>
            <th width="15%"><font size=4>外因</font></th>
            <td width="85%"><font size=4 color=red><strong><%out.print(DictCacheUtil.getInst().selectStrCheck("causecode26","width:100%",causecode26,"26",1));%></strong></font></td>
          </tr>
          <tr>
            <th><font size=4>内因</font></th>
            <td><font size=4 color=red><strong><%out.print(DictCacheUtil.getInst().selectStrCheck("causecode27","width:100%",causecode27,"27",1));%></strong></font></td>
          </tr>
          <tr>
            <th><font size=4>不内外因</font></th>
            <td><font size=4 color=red><strong><%out.print(DictCacheUtil.getInst().selectStrCheck("causecode28","width:100%",causecode28,"28",1));%></strong></font></td>
          </tr>
           <tr>
            <th><font size=4>备注</font></th>
            <td ><input type="text" name="memo" id="memo" value="<%=StringUtilTool.NULL2Blank(memo) %>" style="width:99%"/>
            </td> 
          </tr>
          <tr>
           <td colspan=2 align=center>
           		<input  type="button" value="保存" onclick="savedata();" class="butt"/>
           		<input  type="button" value="返回" onclick="backlist();" class="butt"/>
           </td>
          </tr>
        </table> 
</body>
</html>


